package com.hns.can.master.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hns.can.common.aop.sedate.SedateAnnotation;
import com.hns.can.common.formula.FillCodeDscValue;
import com.hns.can.common.service.CommonInitParamService;
import com.hns.frame.service.CommonService;
import com.hns.tool.pub.PubUtil;
import com.hns.tool.pub.SearchConditionVo;

@Service
public class WarnService extends CommonService{
    
    @Autowired
    private CommonInitParamService commonInitParamService;
    
    @Autowired
    private FillCodeDscValue codeDscValue;
    
    /**
     * 车辆故障次数统计
     * @param vo
     * @return
     * @author:Fisher
     * @email:zhuangcaijin@126.com
     */
    @SedateAnnotation()
    public int getFaultCount(SearchConditionVo vo) {
        if(PubUtil.isEmpty(vo.getOrgIds())){
            return 0;
        }
        int count = (Integer)sqlMapDao.selectOne("warn.getFaultCount", vo);
        return count;
    }
    
    /**
     * 不安全次数统计
     * @param vo
     * @return
     * @author:Fisher
     * @email:zhuangcaijin@126.com
     */
    @SedateAnnotation()
    public int getUnsafeActionCount(SearchConditionVo vo) {
        if(PubUtil.isEmpty(vo.getOrgIds())){
            return 0;
        }
        int count = (Integer)sqlMapDao.selectOne("warn.getUnsafeActionCount", vo);
        return count;
    }
    
    /**
     * 超速统计
     * @param vo
     * @return
     * @author:Fisher
     * @email:zhuangcaijin@126.com
     */
    @SedateAnnotation()
    public int getOverSpeedCount(SearchConditionVo vo) {
        if(PubUtil.isEmpty(vo.getOrgIds())){
            return 0;
        }
        int count = (Integer)sqlMapDao.selectOne("warn.getOverSpeedCount", vo);
        return count;
    }
	
}
